package com.umeox.auto_update

import android.annotation.SuppressLint
import android.widget.TextView
import com.umeox.base.BaseRecyclerViewAdapter
import com.umeox.base.BaseViewHolder

class DeviceTypeListAdapter : BaseRecyclerViewAdapter<String>() {

    private val deviceList = mutableListOf<String>()

    fun refreshData(list: MutableList<String>) {
        deviceList.clear()
        deviceList.addAll(list)
        notifyDataSetChanged()
    }

    override fun getLayoutId(viewType: Int): Int = R.layout.auto_update_item_device

    override fun getDataByPosition(position: Int): String = deviceList[position]

    override fun getTotalSize(): Int = deviceList.size

    @SuppressLint("SetTextI18n")
    override fun convert(holder: BaseViewHolder, data: String, position: Int) {
        holder.getView<TextView>(R.id.tvDeviceName).text = data
    }

}